﻿var avl1;
var avlTimeout;

$(function() {
    $("ul#adminmenu").superfish({
        animation: { height: 'show' },   // slide-down effect without fade-in 
        delay: 100,               // 1.2 second delay on mouseout 
        autoArrows: true,
        hoverClass: 'sfHover'
    });
    avl = $('span[title=avl]');

    prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_beginRequest(
        function(sender, args) {
            avl.text("正在加载...");
            avl.show();
        }
    );
    prm.add_endRequest(
    function(sender, args) {
        InitializeDatePicker();
        InitialButtons();
        if (args.get_error() == null) {
            avl.hide();
        }
        else {
            CallOM(args.get_error().message);
        }
    }
    );
    
    if (avl.hasClass('showonload')) {
        avl.show();
        DelayHideOM();
    }
    else {
        avl.hide();
    }
});

function DelayHideOM() {
    //clearTimeout(avlTimeout);
    if (avl.text() != "") {

        avlTimeout = setTimeout
                (
                        function() {
                            avl.hide();
                        },
                        3000
                );
    }
    else {
        avl.hide();
    }
}

function CallOM(text) {
    avl.text(text);
    avl.show();
    DelayHideOM();
}